package com.ymatou.iapi.productmanager.testcase;

import com.ymatou.iapi.productmanager.parameter.RecentlyUsedCategoryListBean;
import com.ymatou.iapi.productmanager.parameter.product.AddSellerProductRequest;
import com.ymatou.iapi.productmanager.service.RecentlyUsedCategoryListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymttest.business.service.ProductManagerCallServiceV2;
import com.ymttest.business.service.ProductManagerCallServiceV3;
import com.ymttest.utils.EnvSetup;
import org.junit.*;
import org.junit.experimental.categories.Category;
/**
*最近使用的商品类目
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_RecentlyUsedCategoryList{
	private static RecentlyUsedCategoryListBean recentlyusedcategorylistBean;
	private static RecentlyUsedCategoryListCall recentlyusedcategorylistCall;
	private static int sellerId = Integer.parseInt(EnvSetup.getData("productsellerid"));

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("最近使用的商品类目");
	}

	@Before
	public void caseUp() {
		recentlyusedcategorylistBean=new RecentlyUsedCategoryListBean();
		recentlyusedcategorylistCall=new RecentlyUsedCategoryListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(recentlyusedcategorylistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_RecentlyUsedCategoryList_01() {
		Logger.start(true,"最近使用的商品类目");
		try {
			AddSellerProductRequest addProdReq = ProductManagerCallServiceV3.initAddSellerProductRequest(sellerId);
			ProductManagerCallServiceV2.addNewProduct(addProdReq);
			recentlyusedcategorylistBean.setSellerId(sellerId);
			recentlyusedcategorylistCall.setData(recentlyusedcategorylistBean);
			recentlyusedcategorylistCall.callService();			
			Logger.verifyEquals("200",recentlyusedcategorylistCall.getString("Code"),"验证code");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}